<script>
	import wx from 'weixin-js-sdk'
	import music from 'tools/music.js'
	import {
		getshareinfo
	} from 'tools/api.js'
	export default {
		onLaunch: async function() {
			console.log('lunch')
			music.playBgm({
				mute: false
			})
			console.log('lunch1',music)
			// uni.setStorageSync('musicplay', false)
			console.log('App Launch')
			var url = location.href.split('#')[0]
			const res = await getshareinfo(url)
			const appId = 'wx81cca98415403b17'
			wx.config({
				debug: false,
				appId: appId,
				timestamp: res.timestamp,
				nonceStr: res.nonceStr,
				signature: res.signature,
				jsApiList: [
					// 需要使用的JS接口列表,分享默认这几个，如果有其他的功能比如图片上传之类的，需要添加对应api进来
					'checkJsApi',
					'onMenuShareTimeline',
					'onMenuShareAppMessage',
					'onMenuShareQQ',
					'onMenuShareWeibo',
					'onMenuShareQZone',
					'hideMenuItems',
					'showMenuItems',
					'hideAllNonBaseMenuItem',
					'showAllNonBaseMenuItem',
					'updateAppMessageShareData',
					'updateTimelineShareData'
				]
			})
			wx.ready(function() {
				console.log(123)
				console.log(this)
				music.playBgm({
					mute: false
				})
				uni.setStorageSync('musicplay', false)
				console.log(this.$music)
			})

		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
			music.playBgm({
				mute: true
			})
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/static/base.scss"
</style>
